﻿using Microsoft.AspNetCore.Authentication.Cookies;

namespace 日志的使用.自定义的内容
{
    /// <summary>
    /// 这是一个中间件的Filter
    /// 使用[MiddlewareFilter(typeof(SelfMiddleWareFilter))] 在 Controller或Action 上使用
    /// 它的优先级比AuthorizationFilter的级别还要高
    /// </summary>
    public class SelfMiddleWareFilter
    {
        public void Configure(IApplicationBuilder applicationBuilder)
        {
            Console.WriteLine("中间件的Filter");
            CookieAuthenticationOptions options = new CookieAuthenticationOptions();
            applicationBuilder.UseCors(config =>
            {
                config.AllowAnyOrigin();  //允许跨域访问
            });
        }
    }
}
